//
// Created by Administrator on 2025/9/10.
//
#include <iostream>
std::istream& read_and_print(std::istream& is)
{
    auto old_state = is.rdstate();
    std::string input;
    while (is >> input)
    {
        std::cout << input << std::endl;
    }
    is.clear();
    // is.setstate(old_state);
    return is;
}


int main()
{
    std::cout << "the first call read and print" << std::endl;
    read_and_print(std::cin);
    std::cout << "the second call read and print" << std::endl;
    read_and_print(std::cin);
}